<?php
declare(strict_types=1);

namespace Modules\Production\Http\Controllers;

use Catch\Base\CatchController as Controller;
use Modules\Production\Models\DassemblyOrder;
use Illuminate\Http\Request;use Modules\Production\Repository\DassemblyOrderRepository;


class DassemblyOrderController extends Controller
{
    public function __construct(
        protected readonly DassemblyOrder $model
    ){}

    /**
     * 组装单据列表
     * @param Request $request
     * @return mixed
     */
    public function index(Request $request): mixed
    {
        return DassemblyOrderRepository::getList($request->all());
    }

    /**
     * 订单创建
     * @param Request $request
     * @return mixed
     */
    public function store(Request $request)
    {
        return DassemblyOrderRepository::storeBy($request->post());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function show($id)
    {
        return $this->model->firstBy($id);
    }

    /**
     * @param Request $request
     * @param $id
     * @return mixed
     */
    public function update($id, Request $request)
    {
        return $this->model->updateBy($id, $request->all());
    }

    /**
     * @param $id
     * @return mixed
     */
    public function destroy($id)
    {
        return $this->model->deleteBy($id);
    }

    /**
     * 拆卸出库
     * @param Request $request
     */
    public function DassemblyOut(Request $request){

    }

    /**
     * 拆卸入库
     * @param Request $request
     */
    public function DassemblyIn(Request $request){

    }

    /**
     * 组装成品入库
     * @param Request $request
     */
    public function assemblyIn(Request $request){

    }

    /**
     * 组装物料出库
     * @param Request $request
     */
    public function assemblyOut(Request $request){

    }
}
